/*
 * Copyright 2009 Hao Nguyen
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package tetrinet.client;

import gwt.g2d.client.graphics.Color;
import gwt.g2d.client.graphics.KnownColor;

public enum BlockType {
	SHAPE_I(TetrinetGame.CUBE_BLUE,"a"),
	SHAPE_J(TetrinetGame.CUBE_GREEN,"b"),
	SHAPE_L(TetrinetGame.CUBE_GREEN,"b"),
	SHAPE_O(TetrinetGame.CUBE_PINK,"c"),
	SHAPE_S(TetrinetGame.CUBE_RED,"d"),
	SHAPE_T(TetrinetGame.CUBE_YELLOW,"e"),
	SHAPE_Z(TetrinetGame.CUBE_RED,"d"),
	ADD_LINE(TetrinetGame.CUBE_A,"f"),
	REMOVE_SPECIAL_BLOCKS(TetrinetGame.CUBE_B,"g"),
	CLEAR_LINE(TetrinetGame.CUBE_C,"h"),
	GRAVITY(TetrinetGame.CUBE_G,"i"),
	BLOCK_QUAKE(TetrinetGame.CUBE_Q,"j"),
	RANDOM_BLOCK_CLEAR(TetrinetGame.CUBE_R,"k"),
	SWITCH_FIELDS(TetrinetGame.CUBE_S,"l"),
	BLOCK_BOMB(TetrinetGame.CUBE_O,"m"),
	NUKE_FIELD(TetrinetGame.CUBE_N,"n"),;	
	
	private int color;
	private String c;
	private BlockType(int color, String character) {
		this.color = color;
		this.c = character;
	}
	
	public int getColor() {
		return color;
	}
	
	public String getBlockSymbol() {
		return c;
	}

	public static BlockType getByString(String s) {
		if( s=="a"){
			return BlockType.SHAPE_I;
		}
		else if( s=="b"){
			return BlockType.SHAPE_J;
		}
		else if( s=="c"){
			return BlockType.SHAPE_O;
		}
		else if( s=="d"){
			return BlockType.SHAPE_S;
		}
		else if( s=="e"){
			return BlockType.SHAPE_T;
		}
		else if( s=="f"){
			return BlockType.ADD_LINE;
		}
		else if( s=="g"){
			return BlockType.REMOVE_SPECIAL_BLOCKS;
		}
		else if( s=="h"){
			return BlockType.CLEAR_LINE;
		}
		else if( s=="i"){
			return BlockType.GRAVITY;
		}
		else if( s=="j"){
			return BlockType.BLOCK_QUAKE;
		}
		else if( s=="k"){
			return BlockType.RANDOM_BLOCK_CLEAR;
		}
		else if( s=="l"){
			return BlockType.SWITCH_FIELDS;
		}
		else if( s=="m"){
			return BlockType.BLOCK_BOMB;
		}
		else if( s=="n"){
			return BlockType.NUKE_FIELD;
		}
		return null;
	}
}